package com.sky.mapper;

import com.sky.annotation.AutoFile;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {
    List<DishVO> page(Dish dish);

    @AutoFile(OperationType.INSERT)
    void addDish(Dish dish);




    @Select("select * from dish where id =#{id}")
    Dish getById(Long id);

    @AutoFile(OperationType.UPDATE)
    void update(Dish dish);

    @Delete("delete from dish where id =#{id}")
    void deleteById(Long id);

    @Select("select * from dish where category_id=#{categoryId}")
    List<DishVO> getDishVo(Long categoryId);


    List<DishVO> getDishById(Dish dish);


    Integer countByMap(Map map);
}
